Page({
  /**
   * 页面的初始数据
   */
  data: {
    // 轮播图
    list: [
      {
        name: "中国银行",
        url: "https://zx-1311146360.cos.ap-shanghai.myqcloud.com/service/zh_1.png",
      },
      {
        name: "江苏银行",
        url: "https://zx-1311146360.cos.ap-shanghai.myqcloud.com/service/js.png",
      },
      {
        name: "渣打银行",
        url: "https://zx-1311146360.cos.ap-shanghai.myqcloud.com/service/zd_1.png",
      },
      {
        name: "民生银行",
        // url: "https://zx-1311146360.cos.ap-shanghai.myqcloud.com/dingzhi/ms.png",
          url: "https://zx-1311146360.cos.ap-shanghai.myqcloud.com/yinqi_infrom/ms_new.png",
      
      },
      {
        name: "中国邮政储蓄银行",
        url: "https://zx-1311146360.cos.ap-shanghai.myqcloud.com/service/zgyzcx_yh.png",
      },
      {
        name: "南京银行",
        url: "https://zx-1311146360.cos.ap-shanghai.myqcloud.com/service/nanjing.png",
      },
    ],
    selectName: '',
    selectId: '',
    // 下面5个是轮播图配置
    indicatorDots: false,
    vertical: true,
    autoplay: true,
    interval: 5100,
    duration: 500,
    roleCode: '1'
  },
  goWhere(e) {
    const name = e.currentTarget.dataset.name
    switch (name) {
      case '中国银行':
        wx.navigateTo({
          url: "/sub_service/zhongguo/index",
        });
        break;
      case '江苏银行':
        wx.navigateTo({
          url: '/sub_service/jiangsu/index',
        })
        break;
      case '渣打银行':
        wx.navigateTo({
          url: '/sub_service/zhada/index',
        })
        break;
      case '民生银行':
        // wx.navigateTo({
        //   url: '/sub_minsheng/limit/limit',
        // })
        wx.navigateTo({
          url: '/sub_minsheng/limit_page/limit_page',
        })
        break;
      case '中国邮政储蓄银行':
        wx.navigateTo({
          url: '/sub_service/jiangsu/index',
        })
        break;
      case '南京银行':
        wx.navigateTo({
          url: '/sub_nanjing/limit/limit',
        })
        break;
      default:
        break;
    }
  },

  async authIf() {
    // 超管可查看所有
    const vipCode = await getApp().globalData.checkVipStatus('N')
    if (vipCode === 'administrator') {
      this.setData({
        roleCode: 'administrator'
      })
    } else {
      const userInfo = wx.getStorageSync('userInfo') || ''
      const hasList = ['boc', 'jsyh', 'zdyh', 'msyh', 'yzcx', 'njyh']
      if (userInfo.bankType) {
        this.setData({
          roleCode: hasList.includes(userInfo.bankType) ? userInfo.bankType : '',
        })
      } else {
        this.setData({
          roleCode: '',
        })
      }
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {},

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.authIf()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})